<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

$type = JRequest::getCmd( 'type', '' ); 
switch($type){
case 'board':
    require_once( JPATH_COMPONENT.DS.'controllers'.DS.'controller_board.php' ); 
    
    JSubMenuHelper::addEntry(JText::_('Departments'), 'index.php?option=com_mwc_employee');
    JSubMenuHelper::addEntry(JText::_('Organization'), 'index.php?option=com_mwc_employee&type=org'); 
    JSubMenuHelper::addEntry(JText::_('Board'), 'index.php?option=com_mwc_employee&type=board', true);
    
    $controller = new Mwc_EmployeeBoardController();
    break;
case 'org':
    require_once( JPATH_COMPONENT.DS.'controllers'.DS.'controller_org.php' ); 
    
    JSubMenuHelper::addEntry(JText::_('Departments'), 'index.php?option=com_mwc_employee');
    JSubMenuHelper::addEntry(JText::_('Organization'), 'index.php?option=com_mwc_employee&type=org', true); 
    JSubMenuHelper::addEntry(JText::_('Board'), 'index.php?option=com_mwc_employee&type=board');
    
    $controller = new Mwc_EmployeeOrgController();
    break;
default:      
    require_once( JPATH_COMPONENT.DS.'controller.php' );
    
    JSubMenuHelper::addEntry(JText::_('Departments'), 'index.php?option=com_mwc_employee', true);
    JSubMenuHelper::addEntry(JText::_('Organization'), 'index.php?option=com_mwc_employee&type=org'); 
    JSubMenuHelper::addEntry(JText::_('Board'), 'index.php?option=com_mwc_employee&type=board');
    
    $controller = new Mwc_EmployeeController(); 
    break;
}

$controller->execute( JRequest::getCmd( 'task' ) );
$controller->redirect();